/*
 * Android NewsFeed Application is a project for the Technological Educational Institute of Athens.
 * It's purpose is to familiarise the Android SDK and development procedures to students.
 * 
 * 
 * Android NewsFeed version 0.00
 * 
 * $LastChangedDate: 2011-08-11 14:48:40 +0300 (Thu, 11 Aug 2011) $
 * $Author: snoopaki $
 * $Rev: 40 $
 */
package gr.teiath.newsfeed;

import android.content.Intent;
import android.os.Bundle;
import gr.teiath.newsfeed.R;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.util.Log;

public class PrefsActivity extends PreferenceActivity {

	private static final String tag = PrefsActivity.class.getSimpleName();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.prefs);
		
		OnPreferenceClickListener onPrefClick = new OnPreferenceClickListener() {
			public boolean onPreferenceClick(Preference preference) {
				Intent intent = new Intent(PrefsActivity.this, FacultyList.class);
				intent.putExtra("preference", preference.getKey());
				startActivity(intent);
				
				return true;
			}
		};
		
		Preference faculty1 = (Preference) findPreference("faculty1");
		faculty1.setOnPreferenceClickListener(onPrefClick);
		
		Preference faculty2 = (Preference) findPreference("faculty2");
		faculty2.setOnPreferenceClickListener(onPrefClick);
		
		Preference faculty3 = (Preference) findPreference("faculty3");
		faculty3.setOnPreferenceClickListener(onPrefClick);
		
		Preference faculty4 = (Preference) findPreference("faculty4");
		faculty4.setOnPreferenceClickListener(onPrefClick);
		
		Preference faculty5 = (Preference) findPreference("faculty5");
		faculty5.setOnPreferenceClickListener(onPrefClick);
		
		Preference faculty6 = (Preference) findPreference("faculty6");
		faculty6.setOnPreferenceClickListener(onPrefClick);
	}

	@Override
	protected void onStop() {
		super.onStop();
		((NewsfeedApplication) this.getApplicationContext()).preferencesChanged();
		Log.i(tag, "****** PrefsActivity // onStop()");
	}
	
	
}
